import 'dart:convert' show json;

class AppUpdateInfo {

  bool forcedUpdate;
  String downloadUrl;
  String size;
  String updateInfo;
  String versionCode;
  String versionName;

  AppUpdateInfo.fromParams({this.forcedUpdate, this.downloadUrl, this.size, this.updateInfo, this.versionCode, this.versionName});

  factory AppUpdateInfo(jsonStr) => jsonStr == null ? null : jsonStr is String ? new AppUpdateInfo.fromJson(json.decode(jsonStr)) : new AppUpdateInfo.fromJson(jsonStr);

  AppUpdateInfo.fromJson(jsonRes) {
    forcedUpdate = jsonRes['forcedUpdate'];
    downloadUrl = jsonRes['downloadUrl'];
    size = jsonRes['size'];
    updateInfo = jsonRes['updateInfo'];
    versionCode = jsonRes['versionCode'];
    versionName = jsonRes['versionName'];
  }

  @override
  String toString() {
    return '{"forcedUpdate": $forcedUpdate,"downloadUrl": ${downloadUrl != null?'${json.encode(downloadUrl)}':'null'},"size": ${size != null?'${json.encode(size)}':'null'},"updateInfo": ${updateInfo != null?'${json.encode(updateInfo)}':'null'},"versionCode": ${versionCode != null?'${json.encode(versionCode)}':'null'},"versionName": ${versionName != null?'${json.encode(versionName)}':'null'}}';
  }
}

